import { createRouter, createWebHistory } from 'vue-router'
import Worklist from '@/views/worklist.vue'
import test from '@/views/test.vue'
import Login from '@/views/login.vue'
import Usermanagement from '@/views/usermanagement.vue'
import Dailymaintain from '@/views/dailymaintain.vue'
import Inspectinfo from '@/views/inspectinfo.vue'
import Assessinfo from '@/views/assessinfo.vue'
import Keymaintenance from '@/views/keymaintenance.vue'
// import { useCounterStore } from '@/stores/counter'

// const counter = useCounterStore()


const router = createRouter({
	history: createWebHistory(),
	routes: [
		{
			path: '/',
			redirect: '/worklist'
		},
		{
			path: '/worklist',
			component: Worklist,
			name: 'gongzuodan'
		},
		{
			path: '/test',
			component: test
		},
		{
			path: '/dailymaintain',
			component: Dailymaintain
		},
		{
			path: '/inspectinfo',
			component: Inspectinfo
		},
		{
			path: '/assessinfo',
			component: Assessinfo
		},
		{
			path: '/keymaintenance',
			component: Keymaintenance 
		},
		{
			path: '/usermanagement',
			component: Usermanagement
		},
		{
			path: '/login',
			component: Login
		}
	]
})

// router.beforeEach((to, from, next) => {
// 	const isLoggedIn = counter.isLogin;
// 	if (to.matched.some(record => record.meta.requiresAuth)) {
// 	  if (!isLoggedIn) {
// 		next({
// 		  path: '/login',
// 		  query: { redirect: to.fullPath }
// 		});
// 	  } else {
// 		next();
// 	  }
// 	} else {
// 	  next();
// 	}
//   });

export default router